﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BathhouseService.Models.Commonality
{
    /// <summary>
    /// 自动编号类
    /// </summary>
    public static class AutomaticNumbering
    {
        /// <summary>
        /// 获取编号
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public static string GetNumber(int count,string rise)
        {
            int lengthAll = 9;
            int lengthNow = Math.Abs(count).ToString().Length;
            int lengthUse = lengthAll - lengthNow;
            return rise + GetMiddlezero(lengthUse) + (count + 1).ToString();
        }
        /// <summary>
        /// 获取中间零位
        /// </summary>
        /// <returns></returns>
        public static string GetMiddlezero(int length)
        {
            string re = string.Empty;
            for (int i = 0; i < length; i++)
            {
                re += "0";
            }
            return re;
        }
    }
}
